

#pragma once

#include "IStateManager.h"
#include "SeekState.h"
#include "PursuitState.h"
#include "ArriveState.h"
#include "PauseState.h"
#include "InterposeState.h"
#include "OffsetPursuitState.h"
#include "FleeState.h"
#include "EvadeState.h"
#include "HideState.h"
#include "WallAvoidState.h"
#include "PathFollowingState.h"
#include "WanderState.h"
#include "SeperationState.h"
#include "AlignmentState.h"
#include "CohesionState.h"
#include "FlockingState.h"
#include "SeekEvadeState.h"

class StateManager : public IStateManager
{
	friend class GameEngine;
public:

	StateManager();
	~StateManager();

	//Inherited from IStateManager
	void Update();
	void ChangeState(int nextState, int currentState, bool fromPause = false);
	State* CurrentState();
	State* PreviousState();

	//Inherited from IGameManager
	void Initialize();
	void UpdateStarted(const Ogre::FrameEvent &gameTime);
	void UpdateEnded(const Ogre::FrameEvent &gameTime);
	void Cleanup();

	static IStateManager* getSingleton()
	{
		if(!_stateManager)
		{
			_stateManager = new StateManager();
		}
		return _stateManager;
	}

protected:

	static IStateManager* _stateManager;


private:

	State* curState;
	State* preState;

	std::vector<State*>* _stateList;

	void createViewports();
	void setupResources();
};